<template>
  <div>
    <p>Register for the event here</p>
    <button @click="register">Register Me</button>
  </div>
</template>
<script>
import { mapState } from 'vuex'
export default {
  props: ['event'],
  inject: ['GStore'],
  computed: {
    ...mapState(['flashMessage']),
  },
  methods: {
    register() {
      this.$store.commit(
        'SET_FLASH_MESSAGE',
        'You are successfully registered for ' + this.event.title
      )
      // this.GStore.flashMessage =
      //   'You are successfully registered for ' + this.event.title
      setTimeout(() => {
        // this.GStore.flashMessage = ''
        this.$store.commit('SET_FLASH_MESSAGE', '')
      }, 3000)
      this.$router.push({ name: 'EventDetails' })
    },
  },
}
</script>
